package com.example.dmdomain.entity;

import com.example.dmcommom.Enum.ElectricityCategoryEnum;
import com.example.dmcommom.StringUtils;
import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;

@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "electricity_price")
public class ElectricityPrice {

	@EmbeddedId
	private ElectricityPriceKey pk = new ElectricityPriceKey();



	/**
	 * 尖峰价格
	 */
	@Column(name = "price_sharp")
	private BigDecimal priceSharp;

	/**
	 * 高峰价格
	 */
	@Column(name = "price_peek")
	private BigDecimal pricePeek;

	/**
	 * 平时价格
	 */
	@Column(name = "price_shoulder")
	private BigDecimal priceShoulder;

	/**
	 * 低谷价格
	 */
	@Column(name = "price_off_peek")
	private BigDecimal priceOffPeek;

	/**
	 * 深谷价格
	 */
	@Column(name = "price_ravine")
	private BigDecimal priceRavine;


	public void setProvince(String s) {
		this.pk.setProvince(s);
	}

	public void setCity(String s) {
		if (StringUtils.isEmpty(s)) {
			this.pk.setCity("-");
		} else {
			this.pk.setCity(s);
		}

	}

	public void setElectricityCategory(ElectricityCategoryEnum s) {
		this.pk.setElectricityCategory(s);
	}

	public void setVoltage(String s) {
		if (StringUtils.isEmpty(s)) {
			this.pk.setVoltage("-");
		} else {
			this.pk.setVoltage(s);
		}
	}

	public void setType(String s) {
		if (StringUtils.isEmpty(s)) {
			this.pk.setType("-");
		} else {
			this.pk.setType(s);
		}
	}

	public void setConsumption(String s) {
		if (StringUtils.isEmpty(s)) {
			this.pk.setConsumption("-");
		} else {
			this.pk.setConsumption(s);
		}
	}

	public void setYear(int i) {
		this.pk.setYear(i);
	}


	public void setMonth(int i) {
		this.pk.setMonth(i);
	}
}
